package com.angel.service.ServiceImpl;

import com.angel.bean.dto.BabyInfoDto;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.angel.bean.BabyInfo;
import com.angel.mapper.BabyInfoDao;
import com.angel.service.BabyInfoService;

@Service
public class BabyInfoServiceImpl implements BabyInfoService{

    @Resource
    private BabyInfoDao babyInfoDao;

    @Override
    public int insert(BabyInfo babyInfo){
        return babyInfoDao.insert(babyInfo);
    }

    @Override
    public int insertSelective(BabyInfo babyInfo){
        return babyInfoDao.insertSelective(babyInfo);
    }

    @Override
    public int insertList(List<BabyInfo> babyInfos){
        return babyInfoDao.insertList(babyInfos);
    }

    @Override
    public int update(BabyInfo babyInfo){
        return babyInfoDao.update(babyInfo);
    }

    @Override
    public BabyInfo findOne(BabyInfo babyInfo) {
        List<BabyInfo> list =this.findAll(babyInfo);
        if (list==null || list.isEmpty()){
            return null;
        }
        return list.get(0);
    }

    @Override
    public List<BabyInfo> findAll(BabyInfo babyInfo){ return babyInfoDao.findAll(babyInfo); }

    @Override
    public List<BabyInfoDto> searchBabyInfo(BabyInfo babyInfo) {
        return babyInfoDao.searchBabyInfo(babyInfo);
    }

    @Override
    public int delete(BabyInfo babyInfo) { return babyInfoDao.delete(babyInfo);
    }

    @Override
    public List<BabyInfoDto> findAllAndUser(BabyInfo babyInfo) {
        return babyInfoDao.findAllAndUser(babyInfo);
    }
}
